/*=============================================================================
#    The element-comm is a tentative program used to test our ideas.           
#                       Copyright (C)  bgao                                    
#
#     This program is free software; you can redistribute it and/or            
#      modify it under the terms of the GNU General Public License             
#     as published by the Free Software Foundation; either version 2           
#         of the License, or (at your option) any later version.               
#
#     This program is distributed in the hope that it will be useful,          
#    but WITHOUT ANY WARRANTY; without even the implied warranty of           
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            
#             GNU General Public License for more details.                    
#
#    You should have received a copy of the GNU General Public License        
#     along with this program; if not, write to the Free Software             
#      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,             
#                       MA  02110-1301, USA.                                  
#==============================================================================
# $Id: mac_data.h 348 2010-11-29 09:01:16Z bgao $ 
#
# $Author: bgao $ 
#
# $Revision: 348 $ 
#
# $Date: 2010-11-29 17:01:16 +0800 (星期一, 29 十一月 2010) $ 
#
# Description: 
#
=============================================================================*/
/*! @file mac_data.h
 *  @brief This is interface for mac_data module
 */
#ifndef _MAC_DATA_H_
#define _MAC_DATA_H_

#include "common.h"
#include "mac_gen.h"

/*! the definition of options bit-field in the frame */
typedef struct mac_options_t_ {
    uint8 ack   : 1;
    uint8 gts   : 1;
    uint8 indir : 1;
} mac_options_t;

/*! the definition of mac data request */
typedef struct mac_data_req_t_ {
    addr_t src;
    addr_t dest;
    uint16 dest_pan_id;
    uint8 handle;
    //uint8 options;
    mac_options_t opt;
} mac_data_req_t;

/*! the definition of mac data confirmation */
typedef struct mac_data_cfm_t_ {
    uint8 handle;
    int8  status;
    // timestamp is optional
} mac_data_cfm_t;

/*! the definition of mac data indication */
typedef struct mac_data_indict_t_ {
    addr_t src;
    uint16 src_pan_id;
    addr_t dest;
    uint16 dest_pan_id;
    /* msdu and msdu_len are already defined in the buf_t structure */
    uint8 lqi;
    uint8 dsn;
} mac_data_indict_t;

int8 mac_data_req(buf_t *buf, mac_data_req_t *req);

#endif

